package com.example.bestapp.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.NonNull;

public class RingPercentDemo2 extends View {
    private  int mCircleX;
    private  int mCircleY;
    private  int mRadius = 80;
    private Paint mCirclePaint;


    public RingPercentDemo2(Context context) {
        super(context);
        init();
    }

    public RingPercentDemo2(Context context, AttributeSet attrs){
        super(context, attrs);
        init();
    }

    private void init(){
        mCirclePaint = new Paint();
        mCirclePaint.setColor(Color.parseColor("#FCD365"));
        mCirclePaint.setStrokeWidth(15);
        mCirclePaint.setStyle(Paint.Style.STROKE);
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        mCircleX = w/2;
        mCircleY = h/2;
    }

    @Override
    protected void onDraw(@NonNull Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawCircle(mCircleX,mCircleY,mRadius,mCirclePaint);
    }
}
